<template>
  <div class="home">
    <my-header></my-header>
    <my-task :type="false">正在进行</my-task>
    <my-task :type="true">已经完成</my-task>
    <div class="clear-box">
			Copyright © 2014 todolist.cn <span @click="clearTask">clear</span>
    </div>
  </div>
</template>

<script>
import myHeader from '@/components/myHeader/myHeader'
import myTask from '@/components/myTasks/myTask'
import { useStore } from 'vuex'
export default {
  name: 'Home',
  components: {
    myHeader,
    myTask
  },

  setup() {
    const store = useStore()
    function clearTask() {
      // 清除已完成任务
      store.commit('clearTask', false)
    }

    return {
      clearTask
    }
  }
}
</script>
<style lang="scss" scoped>
  .clear-box {
    width: 800px;
    margin: 0 auto;
    text-align: center;
    span {
      color: #888;
      cursor: pointer;
      user-select: none;
    }
  }
</style>
